<!DOCTYPE html>
<html>
<head>
	<div th:include="base-libs :: base-libs" ></div>
	<title>新增签约管理</title>
	<!-- <div th:include="common/fwb-modal :: fwb-modal" /> -->
	<style type="text/css">

		.form-table td {
			padding: 1px;
		}

		.form-table input, select {
			width: 100%!important;
		}
		.td-text{
			text-align: right;
			background: #f7f9fb;
			width: 90px;
			vertical-align: middle!important;
			color: #666;
		}
		.td-content{
			vertical-align: middle!important;
		}

		input, select{
			height: 28px!important;
			line-height: 28px!important;
			padding-left: 4px!important;
			box-sizing: border-box!important;
		}
		.panel{
			margin: 4px 2px;
		}
		.panel-header{
			padding: 10px 5px;
			background: #F2F2F2;
		}
		.panel-body{
			padding-bottom: 2px;
		}
		.panel-tool span{
			margin-right: 20px;
			font-weight: bold;
			cursor: pointer;
			color: #2AC672;
		}

		.rqflLi{
			display: inline-block;
			border: 1px solid #D4D4D4;
			vertical-align: middle;
			padding-right: 8px;
			margin-right: 35px;
			margin-bottom: 4px;
			margin-top: 4px;
			width: 100px;
		}

		.rqflLi label{
			display: inline-block;
			height: 30px;
			padding: 0px 6px;
			margin-right: 4px;
			text-align: center;
			background-color: #f7f9fb;
			border-right: 1px solid #D4D4D4;
		}
		.switchbutton{
			margin-bottom: 2px;
		}
		.switchbutton-on {
			background: #1ea15b;
			color: #fff;
		}

		.fwbLi{
			display: inline-block;
			border: 1px solid #D4D4D4;
			vertical-align: middle;
			padding-right: 8px;
			margin-right: 10px;
			margin-bottom: 4px;
			margin-top: 4px;
		}
		.fwbLi label{
			display: inline-block;
			height: 30px;
			padding: 0px 6px;
			margin-right: 4px;
			text-align: center;
			background-color: #f7f9fb;
			border-right: 1px solid #D4D4D4;
		}
		.fwbLi .fwbsx span{
			display: inline-block;
			height: 100%;
			cursor: pointer;
		}

		.fwbLi input{
			display: inline-block;
			width: 20px!important;
			height: 20px!important;
			vertical-align: middle;
			margin-bottom: 2px;
		}

		.jtcyCzDiv{
			vertical-align: middle;
			text-align: center;
			width: 80px;
		}
		.jtcyCzDiv a{
			margin: auto 4px;
			line-height: 28px;
		}
		#rqflUl .jmrqflInput {
			width: 20px!important;
			height: 20px!important;
			position: relative;
			float: left;
			top: 5px;
			left: 15px;
		}
	</style>

	<script th:src="'/service/js/jtqy.js'"></script>

	<script th:inline="javascript">
        /**读取request中的初始化数据*/
        var data = [[${data}]];
	</script>
	<script type="text/javascript">
		var zydmCache = {};
		var JTQYINFO = StoreCache.getCache("JTQYXQINFO");//家庭签约数据
		var BACKINFO = StoreCache.getCache("XYBACKINFO");//跳转页面
        var qyxxArr; //使用中的签约信息列表
		$(function() {
            $(this).registerManagerPage({
                cacheTables: ["TB_ZY_JTCYGX","TB_ZY_RQFL"]
                ,callback: initView
            });
        });


        function initView(cacheData){
            zydmCache = cacheData;
            $("#btnBack").on("click", btnBackHandler);
            $("#btnSave").on("click", btnSaveHandler);
            /*人群分类*/
            createGzRqfl("rqflUl", zydmCache["TB_ZY_RQFL"]);
            /*服务包*/
            var fwb = data.FWBXX;
            if(!StringUtils.isEmpty(fwb)){
                var div = $("#fwbUl");
                $.each(fwb, function(index, item){
                    var fwbLi = $($("#fwbLi").html());
                    $(fwbLi).find("label").text(item["FWBMC"]);
                    $(fwbLi).find(".jmrqflInput").attr("value" , item["FWBID"])
                        .data({"SFBHYBFWX":item["SFBHYBFWX"], "YBJJZF":item["YBJJZF"]});
                    $(fwbLi).find(".fwbsx").hide();
                    $(fwbLi).find(".fwbsx span").on("click", function(){
                        $(this).find("input:radio").prop("checked", true);
                    });
                    $(fwbLi).find("input:radio:not(:eq(0))").attr("name", item["FWBID"]);
                    //服务包类型区别
                    if(item.FWBLX == '03'){
                        $(fwbLi).find(".jmrqflInput").eq(0).remove();
                        $(div).append(fwbLi);
                    }else{
                        $(fwbLi).find(".jmrqflInput").eq(1).remove();
                        $(div).prepend(fwbLi);
                    }
                    $(fwbLi).find(".jmrqflInput").click(function(){
						/*单选框服务包处理*/
                        var isRadio = $(this).attr("type");
                        if(isRadio == "radio"){
                            $(".jmrqflInput:radio").next().hide();
                        }

                        var flg = $(this).is(":checked");
                        if(flg){
                            var sx = $(this).data("sx");
                            if(!StringUtils.isEmpty(sx)){
                                $(this).data("sx", "");
                                $(fwbLi).find(".fwbsx").show();
                                $(fwbLi).find("input:radio[value='" + sx + "']").prop("checked", true);
                            }else{
                                $(fwbLi).find(".fwbsx").toggle();
                                $(fwbLi).find(".fwbsx :radio").removeAttr("checked");
                            }
                        }else{
                            $(fwbLi).find(".fwbsx").hide();
                        }
                    });
                })

				/*禁选服务包设置----指定已经签订的服务包*/
                $("#SXSJ,#JSSJ").change(function(){
                    var SXSJ = $("#SXSJ").val(),
                        JSSJ = $("#JSSJ").val(),
                        ZJHM = $("#ZJHM").val();
                    if(!StringUtils.isEmpty(SXSJ) && !StringUtils.isEmpty(JSSJ)){
                        $.QuickRemote.AjaxJson(contextRoot + "jtqy/getYqdFwbid", function(result){
                            if(result.state){
                                //服务包类型_已签订
                                var FWBLXS_YQD = result.info.FWBLXS_YQD;
                                if(FWBLXS_YQD.indexOf("01")!=-1 || FWBLXS_YQD.indexOf("02")!=-1){ //免费 || 基础
									$(".dxFwb").removeAttr("checked").prop("disabled","disabled").css("cursor","not-allowed")
                                        .parent().css({"color":"#ccc"})
                                        .find(".fwbsx").hide();
                                }else{
                                    $(".dxFwb").removeAttr("disabled").css("cursor","default")
                                        .parent().css({"color":"#333"})
                                }
                                qyxxArr = result.info.data;
                            }else{
                                $.QuickAlert.alertFail({content: result.info.faultInfo});
                            }

                        }, {SXSJ:SXSJ, JSSJ:JSSJ, ZJHM:ZJHM});
                    }
                })
            }
            //创建团队人员
            var tdry = data.TDRY;
            $.each(tdry, function(){
                var option = $("<option>").attr("value",this.USERID).text(this.XM).data("SJHM",this.SJHM);
                $("#USID").append(option);
			})
            /*动态添加的家庭成员按钮点击事件*/
            $("#jtcyTable").on("click", ".jtcyBtn", function(){
                var action = $(this).attr("action");
                var that = this;
                if("remove" == action){
                    $.QuickAlert.alertConfirm({
						content: "是否删除该条记录"
						,callback: function(){
							$(that).parents("tr").remove();
						}
					})
				}else if ("normal" == action){
					$.QuickAlert.alertConfirm({
						content: "是否加入该成员"
						,callback: function(){
							$(that).prev().val("1");
							$(that).html("取消").attr("action","Invalid");
						}
					})
				}else if ("Invalid" == action){
					$.QuickAlert.alertConfirm({
						content: "是否取消该成员"
						,callback: function(){
							$(that).prev().val("2");
							$(that).attr("action","normal").html("加入");
						}
					})
				}
                
			})
			/*初始化数据*/
            initData();
        }

        /*提交按钮回调*/
        function btnSaveHandler(){
            var validateConfig = {
				/*验证错误默认提示方法*/
                tipsFunc: function(validateFailMsg){
                    var $this = $(this);
                    if(validateConfig.firstErr){
                        $.QuickAlert.alertFail({
                            content: validateFailMsg
                            ,callback: function(){
                                $this.focus();
                            }
                        });
                        validateConfig.firstErr = false;
                    }
                    var oldBorder = $this.attr("oldBorder") || $this.css("border");
                    $this.attr("oldBorder",oldBorder).css("border","1px solid red");
                    $this.click(function(){
                        $(this).css("border",$(this).attr("oldBorder"));
                    })
                },
				/*是否全部校验*/
                validateAll: true,
                firstErr: true
            }
            if($(".form-control").QuickValidate(validateConfig)){
                var params = {JMXX: {}, QYXX: {}, RQFL: [], JTCY: [], QYFWBXX: [], QYFWBSX: []};
                params["QYXX"]["YLJGID"] = JTQYINFO.YLJGID;
                params.YLJGID = JTQYINFO.YLJGID;
                params["QYXXID"] = JTQYINFO.QYXXID;
                params["QYXX"]["YLTDID"] = JTQYINFO.YLTDID;
                params["USID"] = $("#USID").val();
				/*获取居民信息和签约信息的数据*/
				$("#jmxxTable").find(".form-control").each(function(){
				    var name = $(this).attr("name");
				    var value = $(this).val();
                    params["JMXX"][name] = value;
				})
                $("#qyxxTable").find(".form-control").each(function(){
                    var name = $(this).attr("name");
                    if(!StringUtils.isEmpty(name)){
                        var value = $(this).val();
                        params["QYXX"][name] = value;
					}
                })
				/*获取人群分类*/
                var rqfl = [];
                $("#rqflUl").find(".jmrqflInput").each(function(){
                    var checked = $(this).is(":checked");
                    if(checked){
                        var value = $(this).val();
                        rqfl.push({RQFLID: value});
                    }
                });
                params["RQFL"] = rqfl;
                /*获取服务包信息*/
                var QYFWBXX = [];
                var QYFWBSX = [];
                var QYFWBMC = [];
                var isSFBHYBFWX = false,YBJJZF = 0; //是否包含医保服务项 || 医保基金总付
                $("#fwbUl").find(".jmrqflInput").each(function(){
                    var checked = $(this).is(":checked");
                    if(checked){
                        var fwbmc = {};
                        var value = $(this).val();
                        var mc = $(this).prev().html();
                        QYFWBXX.push(value);
                        var fwbsx = $(this).siblings(".fwbsx");
                        var sxmc = $(fwbsx).find("input:radio:checked").parent().text();
                        var value_sx = $(fwbsx).find("input:radio:checked").val();
                        QYFWBSX.push(value_sx);
                        fwbmc["MC"] = mc + "(" + sxmc + ")";
                        fwbmc["ID"] = value ;
                        QYFWBMC.push(fwbmc);
                        var SFBHYBFWX = $(this).data("SFBHYBFWX");
                        if(SFBHYBFWX==1){
                            YBJJZF += parseFloat($(this).data("YBJJZF"));
                            isSFBHYBFWX = true;
                        }
                    }
                });
                params["QYFWBXX"] = QYFWBXX;
                params["QYFWBSX"] = QYFWBSX;
                params["QYFWBMC"] = QYFWBMC;
                /*获取家庭成员信息*/
                var JTCYARY = [];
				$("#jtcyTable").find(".cyxxTr").each(function(){
					var jtcy = {};
					$(this).find(".form-control").each(function(){
					    var name = $(this).attr("name");
					    var value = $(this).val();
                        jtcy[name] = value;
					})
                    JTCYARY.push(jtcy);
				})
				params["JTCY"] = JTCYARY;
				/*签约团队名称*/
				params["QYTDMC"] = JTQYINFO.TDMC;
				/* 乙方医生姓名*/
                params.YFXM = $("#USID option:selected").text();
                params.YFSJHM = $("#USID option:selected").data("SJHM");
                params.YFYLJGMC = $("#SZYY").val();

				/*重复签订服务包判断*/
                var tip = "该居民已经在：<br/>";
                var isCfFwb = false;
                var tsFwbid = []; //已提示的服务包
                $.each(qyxxArr, function(i,qyxx){
                    var FWBID = qyxx.FWBID;
                    $.each(QYFWBXX,function(j,fwbid){
                        if($.inArray(fwbid,tsFwbid) == -1 && FWBID.indexOf(fwbid) != -1){
                            tip += qyxx.YLJGMC + "的";
                            tip += qyxx.TDMC + "团队签订";
                            tip += $("#fwbUl .jmrqflInput:checked").eq(j).prev().html() + "<br/>";
                            isCfFwb = true;
                            tsFwbid.push(fwbid);
                        }

                    })
                })
                tip += "是否继续签约？";
                if(isCfFwb){
                    $.QuickAlert.alertConfirm({
                        content : tip,
                        area: ["auto","auto"],
                        callback : function() {
                            lastConfirm();
                        }
                    })
                }else{
                    lastConfirm();
                }
			}

            function lastConfirm(){
				/*选择了：包含医保服务项的服务包*/
                if(isSFBHYBFWX){
                    StoreCache.setCache("managerData",{YBJJZF_MAX: YBJJZF,YBFWX_ARR:$("body").data("YBFWX_ARR")});
                    parent.layer.open({
                        type: 2,
                        area: ["60%", "500px"],
                        content: contextRoot + 'jtqy/selectYbfwx.html',
                        scrollbar: false,
                        resize: false,
                        title:$($("#selectYbfwxTitle").html()).find("#total").text(YBJJZF).end().prop("outerHTML"),
                        end: function(){
                            var YBFWX_ARR = StoreCache.removeCache("YBFWX_ARR");
                            if(!StringUtils.isEmpty(YBFWX_ARR)){
                                $("body").data("YBFWX_ARR", YBFWX_ARR);
                                params["YBFWX_ARR"] = YBFWX_ARR;
                                toJtqyXy(params);
                            }
                        }
                    });
                }else{
                    toJtqyXy(params);
                }

            }
		}

		function toJtqyXy(params){
                /*添加协议确认页面*/
                StoreCache.setCache("xzqy_qyxx", params);
                StoreCache.setCache("SFXY","1"); //是否正在续约
    //            var BACKINFO1 = $.extend({},BACKINFO);
    //            BACKINFO1.RETURN = "xyManager.html?JMXXID=" + JTQYINFO.JMXXID + "&YLJGID=" + JTQYINFO.YLJGID + "&TDID=" + JTQYINFO.YLTDID;
                //StoreCache.setCache("QYXYBACKINFO",BACKINFO1);
    //            location = contextRoot + "jtqy/jtqyXy.html";
                parent.layer.open({
                    type: 2,
                    area: ["800px", "90%"],
                    content: contextRoot + "jtqy/jtqyXy.html",
                    scrollbar: false,
                    resize: false,
                    title:"家庭医生签约协议",
                    end: function(){
                        if(StoreCache.removeCache("toIndex")){
                            location = "/service/jtqy/index.html";
                        }
                    }
                });
		}
        /**校验服务包 选择服务包必须选择服务包类型*/
        function validateFwb(){
            var valid = "";
            var hasChecked = false;
            $(this).find(".jmrqflInput").each(function(){
                var checked = $(this).is(":checked");
                if(checked){
                    hasChecked = true;
                    var value = $(this).val();
                    var fwbsx = $(this).siblings(".fwbsx");
                    var value = $(fwbsx).find("input:radio:checked").val();
                    if(StringUtils.isEmpty(value)){
                        valid = "请选择服务包适用于个人或家庭";
                    }
					/*选择家庭 一定要有家庭成员*/
                    else if("2" == value){
                        var length = $("#jtcyTable").find("tr").length;
                        if(length<=0){
                            valid = "您选择了服务包适用于家庭，请新增家庭成员！";
                        }
                    }
                }
            });
            if(!hasChecked){
                valid = "请选择服务包";
            }
            return valid;
        }
		
        function initDateTime(){
        	var qysjItem = {};
        	//结束日期
            var endTime = stringToJsTime_(JTQYINFO["JSSJ"])
            endTime.setDate(endTime.getDate() + 1);
        	var endTimeObj = {
        			elem : '#JSSJ',
        			min : endTime.format('yyyy-MM-dd'),
                	istoday: false,
        		  	choose: function(datas){
        		  		startTimeObj.max = datas;
                        var lastChoose = $("#JSSJ").data("lastChoose");
                        if(datas != lastChoose){
                            $("#JSSJ").trigger("change");
                            $("#JSSJ").data("lastChoose",datas);
                        }
        		    }
        	};
        	//生效日期
        	var startTime = stringToJsTime_(JTQYINFO["SXSJ"])
            startTime.setDate(startTime.getDate() + 1);
        	var startTimeObj = {
        		elem : '#SXSJ',
        		 min : startTime.format('yyyy-MM-dd'),
        		 max : endTime.format('yyyy-MM-dd'),
                 istoday: false,
        		 choose: function(datas){
        			 endTimeObj.min = datas;
                     var lastChoose = $("#SXSJ").data("lastChoose");
                     if(datas != lastChoose){
                         $("#SXSJ").trigger("change");
                         $("#SXSJ").data("lastChoose",datas);
                     }
        		 }
        	};
        	laydate(startTimeObj);
        	laydate(endTimeObj);
         	var nowdate = new Date();
           	var currentdate =nowdate.format('yyyy-MM-dd');
            var currentdate2 =nowdate.format('yyyy-MM-dd hh:mm:ss');
           	endTime.setDate(endTime.getDate() + 1);
            $("#QYSJ").val(currentdate2);
            qysjItem.QYSJ = currentdate2;
            $("#SXSJ").val(endTime.format('yyyy-MM-dd'));
            qysjItem.SXSJ = endTime.format('yyyy-MM-dd');
            endTime.setFullYear(endTime.getFullYear()+1);
            endTime.setDate(endTime.getDate() - 1);
            $("#JSSJ").val(endTime.format('yyyy-MM-dd'));
            qysjItem.JSSJ = endTime.format('yyyy-MM-dd');
            return qysjItem;
        }
		/*查询历史记录*/
        function findLsjl(){
            if(StringUtils.isEmpty(data.JMXX.JMXXID)){
                $.QuickAlert.alertFail({
                    content : "该人员没有签约记录！"
                });
                return ;
            }
            findQyxxLsjl(data.JMXX.JMXXID);
        }

        function initData(){
        	var qyxx = StoreCache.removeCache("xzqy_qyxx");
        	if(StringUtils.isEmpty(qyxx)){
        		data.YLJGMC = JTQYINFO["SZYY"];
        		data.TDMC = JTQYINFO["TDMC"];
        		data.JMXX = {
        				XM : JTQYINFO["XM"]
        				,XB : JTQYINFO["XB"]
        				,ZJHM : JTQYINFO["ZJHM"]
        				,CSRQ : JTQYINFO["CSRQ"]
        				,JZKH : JTQYINFO["JZKH"]
        				,SJHM : JTQYINFO["SJHM"]
        				,JTZZ : JTQYINFO["JTZZ"]
        				,JHRXM : JTQYINFO["JHRXM"]
        				,YJFGX : JTQYINFO["YJFGX"]
        				,LXDH : JTQYINFO["LXDH"]
        				,SFZH : JTQYINFO["SFZH"]
        				,JMXXID : JTQYINFO["JMXXID"]
        		};
        		data.RQFL = [];
        		var rqflids = JTQYINFO["RQFLID"].split(",");
        		$.each(rqflids,function(item,value){
        			data.RQFL.push({RQFLID:value});
        		})
        		data.QYXX = initDateTime();
        		data.PTJGID = JTQYINFO["YLJGID"];
        	}else{
        		data = qyxx;
        	}
            $("#SZYY").val(JTQYINFO["SZYY"]);
            $("#TDMC").val(JTQYINFO["TDMC"]);
            $("#USID").val(data["QYXX"]["USID"]);
            setJmxx(data.JMXX);
            setQyxx(data.QYXX);
            setRqfl(data.RQFL);
            setJtcy(data.JTCY);
            setFwbxx(data.QYFWBXX, data.QYFWBSX);
        }


        /**如果存在未填写完整的成员信息 则不能添加新成员*/
        function canAddJtcy(){
            var add = true;
            $("#jtcyTable").find("[name='SFZH']").each(function(){
                var SFZH = $(this).val();
                var that = this;
                if(StringUtils.isEmpty(SFZH)){
                    $.QuickAlert.alertFail({
						content: "请填写完成当前家庭成员信息"
						,callback: function(){
							$(that).focus();
						}
					});
                    add = false;
                    return false;
				}
			})
			return add;
		}

		/**创建初始化家庭成员记录*/
		function createJtcyjl(){
            var jtcy = $($("#cyxxTr").html());
            var cygx = zydmCache["TB_ZY_JTCYGX"];
            jtcy.find("[cacheTable]").createOptions(cygx);
            //jtcy.find("input[name='RYSX']").hide();
            return jtcy;
		}

		/**设置居民信息*/
		function setJmxx(jmxx){
            if(jmxx){
            	var CSRQ = jmxx.CSRQ;
            	if(!StringUtils.isEmpty(CSRQ)) jmxx.CSRQ = CSRQ.substring(0,10);
                $("#jmxxTable").find(".form-control").each(function(){
                    var name = $(this).attr("name");
                    var value = jmxx[name];
                    $(this).val(value);
                })
			}
		}
		/**设置签约信息*/
		function setQyxx(qyxx){
            if(qyxx){
                $("#qyxxTable").find(".form-control").each(function(){
                	if(!$(this).hasClass("ignore")){
	                    var name = $(this).attr("name");
	                    var value = qyxx[name];
	                    $(this).val(value);
                	}
                })
            }
            //查询该签约时间段禁用的服务包
            $("#SXSJ").trigger("change");
		}
        /**设置人群分类*/
        function setRqfl(rqfl){
            if(rqfl) {
                $.each(rqfl, function (index, item) {
                    $("#rqflUl").find(".jmrqflInput").each(function () {
                        var value = $(this).val();
                        if (value == item["RQFLID"]) {
                            $(this).prop("checked", true);
                            return false;
                        }
                    });
                })
            }
        }
		/**设置家庭成员*/
		function setJtcy(jtcy){
            if(jtcy){
				$.each(jtcy, function(index, item){
                    addJtcyHandler(item);
				})
			}
		}
        /**设置服务包信息 选择的服务包和服务包类型*/
        function setFwbxx(QYFWBXX, QYFWBSX){
            if(QYFWBXX){
                $.each(QYFWBXX, function(index, item){
                    $("#fwbUl").find(".jmrqflInput").each(function(){
                        var value = $(this).val();
                        if(value == item){
                            var sx = QYFWBSX[index];
                            $(this).data("sx", sx);

							/*radio执行点击事件不会选中，而checkbox执行点击事件会选中*/
                            if($(this).attr("type")=="radio")
                                $(this).attr("checked","checked");

                            $(this).trigger("click");
                            return false;
                        }
                    });
                })
            }
        }

		/**返回回调*/
		function btnBackHandler()
		{
			//StoreCache.setCache("JTQYXQINFO", JTQYINFO);
            StoreCache.removeCache("XYBACKINFO");//跳转页面
			location = BACKINFO.FAIL;
		}

	</script>
</head>
<body class="easyui-layout">
	<div region="north" style="height: 41px; border: none; overflow: hidden; background-color: #f9f9f9;">
		<div class="title">
			<h3>新增续约</h3>
		</div>
	</div>
	<div region="center" style="overflow: auto; border: none;">
		<div class="easyui-panel" title="居民基本信息">
			<table id="jmxxTable" class="form-table">
				<tr>
					<td class="td-text">
						<label>居民姓名：</label>
					</td>
					<td class="td-content">
						<input type="text" name="XM" id="XM"  autocomplete="off"
						   quick-config="label:'居民姓名', validateProxy:'notNull length', length: '30'"
						   class="layui-input dataField form-control">
						<input name="JMXXID" class="form-control" style="display: none;">
					</td>
					<td class="td-text">
						<label>性别：</label>
					</td>
					<td class="td-content">
						<select name="XB" id="XB" disabled="disabled" class="cacheTable dataField form-control" cacheTable="TB_ZY_XB" quick-config="label:'性别', validateProxy:'notNull'"   >
						</select>
					</td>
					<td class="td-text">
						<label>证件号码：</label>
					</td>
					<td class="td-content">
						<input type="text" name="ZJHM" id="ZJHM" autocomplete="off" readonly="readonly" readonly="readonly" 
							   quick-config="label:'证件号码', validateProxy:'notNull length', length: '30'"
							   class="layui-input dataField form-control">
					</td>
					<td class="td-text">
						<label>出生日期：</label>
					</td>
					<td class="td-content">
						<input type="text" name="CSRQ" id="CSRQ" readonly="readonly" autocomplete="off"
							   quick-config="label:'出生日期', validateProxy:'notNull length', length: '16'"
							   class="layui-input dataField laydate-icon form-control">
					</td>
				</tr>
				<tr>
					<td class="td-text">
						<label>就诊卡号：</label>
					</td>
					<td class="td-content">
						<input type="text" name="JZKH" id="JZKH"  autocomplete="off"
						   quick-config="label:'就诊卡号', validateProxy:'length', length: '64'"
						   class="layui-input dataField form-control">
					</td>
					<td class="td-text">
						<label>手机号码：</label>
					</td>
					<td class="td-content">
						<input type="text" name="SJHM" id="SJHM" autocomplete="off"
						   quick-config="label:'手机号码', validateProxy:'notNull num length', length: '16'"
						   class="layui-input dataField form-control">
					</td>
					<td class="td-text">
						<label>家庭地址：</label>
					</td>
					<td class="td-content" colspan="3">
						<input type="text" name="JTZZ" id="JTZZ" autocomplete="off"
						   quick-config="label:'家庭地址', validateProxy:'notNull length', length: '200'"
						   class="layui-input dataField form-control">
					</td>
				</tr>
				<tr>
					<td colspan="8">
						18岁以下未成年人、精神疾病患者等对象，应由其监护人代为签约，增加以下内容：
					</td>
				</tr>
				<tr>
					<td class="td-text">
						<label>监护人姓名：</label>
					</td>
					<td class="td-content">
						<input type="text" name="JHRXM" id="JHRXM" autocomplete="off"
						   quick-config="label:'监护人姓名', validateProxy:'length', length: '30'"
						   class="layui-input dataField form-control">
					</td>
					<td class="td-text">
						<label>与甲方关系：</label>
					</td>
					<td class="td-content">
						<input type="text" name="YJFGX" id="YJFGX" autocomplete="off"
						   quick-config="label:'与甲方关系', validateProxy:'length', length: '30'"
						   class="layui-input dataField form-control">
					</td>
					<td class="td-text">
						<label>联系电话：</label>
					</td>
					<td class="td-content">
						<input type="text" name="LXDH" id="LXDH" autocomplete="off"
						   quick-config="label:'联系电话', validateProxy:'num length', length: '30'"
						   class="layui-input dataField form-control">
					</td>
					<td class="td-text">
						<label>身份证号：</label>
					</td>
					<td class="td-content">
						<input type="text" name="SFZH" id="SFZH" autocomplete="off"
						   quick-config="label:'身份证号', validateProxy:'length', length: '30'"
						   class="layui-input dataField form-control">
					</td>
				</tr>
			</table>
		</div>
		<div class="easyui-panel" title="居民基本情况">
			<table class="form-table">
				<tr>
					<td class="td-content" colspan="8" style="border: none;">
						<ul id="rqflUl">
						</ul>
					</td>
				</tr>
			</table>
		</div>
		<div class="easyui-panel" title="家庭成员管理" data-options="tools:'#toolJtcygl'">
			<div id="toolJtcygl">
				<span onclick="addJtcyHandler()" href="javascript:void(0)" style="font-weight: bold; cursor: pointer; color: #2AC672;">新增成员</span>
			</div>
			<table id="jtcyTable" class="form-table">
			</table>
		</div>
		<div class="easyui-panel" title="签约信息" data-options="tools:'#toolQyxx'">
			<div id="toolQyxx">
				<span onclick="findLsjl()" href="javascript:void(0)">历史记录</span>
			</div>
			<table id="qyxxTable" class="form-table">
				<tr>
					<td class="td-text">
						<label>服务包选择：</label>
					</td>
					<td class="td-content" colspan="5">
						<div>
							<ul id="fwbUl" class="form-control" quick-config="validateProxy:'validateFwb'">
							</ul>
						</div>
					</td>
				</tr>
				<tr>
					<td class="td-text">
						<label>所在医院：</label>
					</td>
					<td>
						<input type="text" id="SZYY" value="医院名称" readonly="readonly"  autocomplete="off"
							   class="layui-input">
					</td>
					<td class="td-text">
						<label>签约团队：</label>
					</td>
					<td>
						<input type="text" id="TDMC" name="TDMC" readonly="readonly"  autocomplete="off"
							   class="layui-input">
					</td>
					<td class="td-text">
						<label>签约医生：</label>
					</td>
					<td>
						<select name="USID" id="USID" class="dataField form-control ignore"
						quick-config="label:'签约医生', validateProxy:'notNull'">
							<option value="">请选择</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="td-text">
						<label>签约日期：</label>
					</td>
					<td>
						<input type="text" name="QYSJ" id="QYSJ" readonly="readonly" autocomplete="off" onclick="laydate({format:'YYYY-MM-DD hh:mm:ss',istime:true})"
							   quick-config="label:'签约日期', validateProxy:'notNull'"
							   class="laydate-icon layui-input dataField form-control">
					</td>
					<td class="td-text">
						<label>生效日期：</label>
					</td>
					<td>
						<input type="text" name="SXSJ" id="SXSJ" readonly="readonly" autocomplete="off"
							   quick-config="label:'生效日期', validateProxy:'notNull length', length: '16'"
							   class="laydate-icon layui-input dataField form-control">
					</td>
					<td class="td-text">
						<label>结束日期：</label>
					</td>
					<td>
						<input type="text" name="JSSJ" id="JSSJ" readonly="readonly" autocomplete="off"
							   quick-config="label:'结束日期', validateProxy:'notNull length', length: '16'"
							   class="laydate-icon layui-input dataField form-control">
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div region="south" style="height: 41px; border: none; overflow: hidden; background-color: #f9f9f9; padding-top: 6px; text-align: center;">
		<button id="btnSave" type="button" style=" margin-left: 10px;">协议确认</button>
		<button id="btnBack" type="button" style=" margin-left: 10px;">返回</button>
	</div>
</body>
<script type="text/html" id="fwbLi">
	<li class="fwbLi">
		<label></label>
		<input class="jmrqflInput dxFwb" type="radio" name="InputFwb">
		<input class="jmrqflInput" type="checkbox" name="InputFwb">
		<span class="fwbsx" style="display: inline-block;height: 100%;padding-left: 2px;border-left: 1px dashed #ccc;">
			<span><input type="radio" value="1">个人</span>
			<span><input type="radio" value="2">家庭</span>
		</span>
	</li>
</script>
<script type="text/html" id="cyxxTr">
	<tr class="cyxxTr">
		<td class="td-text">
			<label>身份证号：</label>
		</td>
		<td class="td-content" style="width: 160px;">
			<input type="text" autocomplete="off" name="SFZH"
				   quick-config="label:'家庭成员的身份证号', validateProxy:'notNull idCard length', length: '20'"
				   class="form-control">
		</td>
		<td class="td-text">
			<label>成员姓名：</label>
		</td>
		<td class="td-content" style="width: 120px;">
			<input type="text"  autocomplete="off" name="XM"
				   quick-config="label:'成员姓名', validateProxy:'notNull length', length: '30'"
				   class="form-control">
		</td>
		<td class="td-text">
			<label>成员关系：</label>
		</td>
		<td class="td-content" style="width: 160px;">
			<select class="form-control" name="CYGXDM" cacheTable="TB_ZY_JTCYGX" quick-config="label:'成员关系', validateProxy:'notNull'"   >
			</select>
		</td>
		<td class="td-content" style="min-width: 210px;">
			<input type="text" readonly="readonly" name="QYXX" autocomplete="off"
				   class="form-control" onmouseover="this.title=this.value">
		</td>
		<td>
			<div class="jtcyCzDiv">
				<input name="RYSX" class="form-control" hidden="hidden" >
				<a class="jtcyBtn" action="remove">移除</a>
			</div>
		</td>
	</tr>
</script>

<!--医保服务项——弹窗的title -->
<script type="text/html" id="selectYbfwxTitle">
	<div>
		<span>您选择了包含医保服务项的服务包，请自主选择医保服务项</span>
		<span style="margin-left:20px;">总价在</span>
		<span style="font-size:16px;color:blue" id="total"></span>
		<span>元以内</span>
	</div>
</script>
</html>
